﻿#Region "Header"
'Title:     Selection Case Lab
'Author:    Greg Cronk
'Date:      02/25/2014
'Course:    CSC 162
'Section:   401
'Description:   This program allows the user to enter 2 strings converts a numeric string into a letter then parses the 2 values out.
'
'Initial Algorithm:
'   1.  Get Course Name and Numeric Grade from user
'   2.  Convert numeric grade to a Letter Grade
'   3.  Display the Course with the Letter Grade in the Output
'   4.  Store the Course and Letter Grade and append to a Static
'
'Data Requirements:
'   Input:
'       Course Name and Numeric Grade
'   Output:
'       Words listed by alphabetical order
'   
'
'Formulas:
'  A >= 90
'  B >= 80
'  C >= 70
'  D >= 60
'  Anything below 60 = F
'
'Refine Algorith In Subs as used.
#End Region
Public Class frmGradeLogger
    Private Sub btnResults_Click(sender As System.Object, e As System.EventArgs) Handles btnResults.Click

        'If Course Name Text is a number Then
        '  Display message box asking for a non-numeric entry
        '  If Grade Text is a number Then
        '    Select Case for Text
        '     Case Is < 60 
        '      Grade = F
        '    Case 60 to 69.9 Then
        '      Grade = D
        '    Case Is 70 to 79.9 Then
        '      Grade = C
        '    Case Is 80 to 89.9 Then 
        '      Grade = B
        '    Case >= 90 Then
        '      Grade = A
        '    End Select
        '  Else 
        '    Display message box asking for a Numeric Value
        '  EndIf 
        'Else 
        '  Course = Course Name Text
        ' Display Course and Grade in Output Label and add New Line
        ' Output Static = Output Label text

        'Declare Varibles.
        Static CompileGrades As String
        Dim CourseName As String
        Dim ltrGrade As String


        'Check or Numeric Only Entry for Course Name
        If IsNumeric(txtCourse.Text) = False Then
            CourseName = txtCourse.Text

            'Assign Letter Grades to Numeric Grade Values
            If IsNumeric(txtGrade.Text) Then
                Select Case txtGrade.Text
                    Case Is < 60
                        ltrGrade = "F"
                    Case 60 To 69.9
                        ltrGrade = "D"
                    Case 70 To 79.9
                        ltrGrade = "C"
                    Case 80 To 89.9
                        ltrGrade = "B"
                    Case Is >= 90
                        ltrGrade = "A"
                End Select

            Else
                'Prompt the User to give a numeric Grade Value
                Dim TextEntry As String
                TextEntry = MsgBox("Please Enter a Numeric Value")
                txtGrade.Focus()
            End If
        Else
            'Prompt the User to give a Alpha Numeric Title for the Course.
            Dim NumericEntry As String
            NumericEntry = MsgBox("Please Enter The Course Alpha-Numeric Title")
            txtCourse.Focus()
        End If

        'Output the Results and Store the information in the Compiled Data

        lblOutput.Text = CourseName & " " & ltrGrade & CompileGrades
        CompileGrades = ControlChars.NewLine & lblOutput.Text

    End Sub

    Private Sub btnExit_Click(sender As System.Object, e As System.EventArgs) Handles btnExit.Click
        'Close the Window and Release the Used Memory
        Me.Close()
        End
    End Sub

    
End Class
